{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Introduction to atomman: Running LAMMPS and the Log class\n",
    "\n",
    "__Lucas M. Hale__, [lucas.hale@nist.gov](mailto:lucas.hale@nist.gov?Subject=ipr-demo), _Materials Science and Engineering Division, NIST_.\n",
    "    \n",
    "[Disclaimers](http://www.nist.gov/public_affairs/disclaimer.cfm) "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. Introduction<a id='section1'></a>\n",
    "\n",
    "This Notebook outlines the options of the atomman.lammps.Log class and the atomman.lammps.run() function."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Library Imports**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "atomman version = 1.4.0\n",
      "Notebook executed on 2021-08-05\n"
     ]
    }
   ],
   "source": [
    "# Standard libraries\n",
    "import os\n",
    "import glob\n",
    "import time\n",
    "import datetime\n",
    "\n",
    "# http://matplotlib.org/\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "\n",
    "# https://github.com/usnistgov/atomman\n",
    "import atomman as am            \n",
    "import atomman.lammps as lmp\n",
    "import atomman.unitconvert as uc\n",
    "\n",
    "# Show atomman version\n",
    "print('atomman version =', am.__version__)\n",
    "\n",
    "# Show date of Notebook execution\n",
    "print('Notebook executed on', datetime.date.today())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. Running LAMMPS<a id='section2'></a>\n",
    "\n",
    "*Updated version 1.4.0:* Parameters updated to provide more running options and remove obsolete Log class-based parameters.  \n",
    "\n",
    "The LAMMPS simulation can be ran from within Python using the run() function.  This runs LAMMPS as a subprocess, meaning that it can use any installed LAMMPS and MPI executables.\n",
    "\n",
    "Parameters\n",
    "\n",
    "- __lammps_command__ *(str*) The LAMMPS inline run command (sans -in script_name).\n",
    "- __script_name__ *(str, optional*) Path of the LAMMPS input script file to use.  Either script_name or script must be given.\n",
    "- __script__ *(str, optional*) The LAMMPS input script command lines to use.  Either script_name or script must be given.\n",
    "- __mpi_command__ *(str or None, optional*) The MPI inline command to run LAMMPS in parallel. Default value is None (run serially).\n",
    "- __restart_script_name__ *(str or None, optional*) Path to an alternate LAMMPS input script file to use for restart runs. If given, the restart script will be used if the specified logfile already exists.  Requires logfile to not be None.\n",
    "- __restart_script__ (*str, optional*) Alternate LAMMPS script command lines to use for restart runs. If given, the restart script will be used if the specified logfile already exists.  Requires logfile to not be None.\n",
    "- __logfile__ *(str or None, optional*) Specifies the path to the logfile to write to.  Default value is 'log.lammps'.  If set to None, then no logfile will be created.\n",
    "- __screen__ *(bool, optional*) If True (default), then the resulting Log object is built from the LAMMPS screen output.  If False, then LAMMPS outputs no screen info and the Log object will be built by reading logfile.\n",
    "- __suffix__ *(str, optional*) Allows for the LAMMPS suffix option to be specified to use any of the accelerated versions of pair styles if available.\n",
    "\n",
    "Returns\n",
    "\n",
    "- (*atomman.lammps.Log*) An object representation of the log.lammps file."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Create a simple demonstration LAMMPS input script"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "script = \"\"\"\n",
    "#Simple demonstration LAMMPS script\n",
    "\n",
    "units metal\n",
    "atom_style atomic\n",
    "boundary p p p \n",
    "\n",
    "lattice fcc 3.52 origin 0.100000 0.100000 0.100000 \n",
    "        \n",
    "region box block 0 15 0 15 0 15\n",
    "create_box 1 box\n",
    "create_atoms 1 box\n",
    "\n",
    "mass 1 58.71\n",
    "\n",
    "pair_style lj/cut 6\n",
    "pair_coeff 1 1 0.5408 2.272\n",
    "\n",
    "velocity all create 100 2987532\n",
    "\n",
    "thermo 100\n",
    "thermo_style custom step pe temp press lx ly lz\n",
    "\n",
    "restart 10000 *.restart\n",
    "\n",
    "timestep 0.01\n",
    "\n",
    "fix 1 all npt temp 100 100 1.0 aniso 0.0 0.0 10.0\n",
    "run 10000\n",
    "\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Run in serial"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Serial simulation took 98.3661994934082 seconds.\n"
     ]
    }
   ],
   "source": [
    "# Define lammps command to use (unique to your computer!)\n",
    "lammps_command = 'lmp_mpi'\n",
    "\n",
    "# Run and measure execution time\n",
    "start = time.time()\n",
    "results = lmp.run(lammps_command, script=script)\n",
    "end = time.time()\n",
    "run_time = end-start\n",
    "\n",
    "print(f\"Serial simulation took {run_time} seconds.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Run in parallel on 4 processors"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Parallel simulation took 47.57556772232056 seconds.\n"
     ]
    }
   ],
   "source": [
    "# Define lammps command to use (unique to your computer!)\n",
    "lammps_command = 'lmp_mpi'\n",
    "\n",
    "# Define mpi command to use (unique to your computer!)\n",
    "mpi_command = 'C:/Program Files/MPICH2/bin/mpiexec.exe -localonly 4'\n",
    "\n",
    "# Run and measure execution time\n",
    "start = time.time()\n",
    "results = lmp.run(lammps_command, script=script, mpi_command=mpi_command)\n",
    "end = time.time()\n",
    "run_time = end-start\n",
    "\n",
    "print(f\"Parallel simulation took {run_time} seconds.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3. Accessing results with Log class<a id='section3'></a>\n",
    "\n",
    "*Updated version 1.3.7*: now captures performance output.  A Simulation class is added to better represent each run/simulation.  The flatten method is updated to return a new Simulation rather than overwriting the current data.  New 'all' style added to flatten that will merge all runs without filtering out duplicate timesteps. \n",
    "\n",
    "Information from the log.lammps file(s) is automatically parsed by the run() function and returned as an atomman.lammps.Log object.  Currently, the Log class stores the following information:\n",
    "\n",
    "- **lammps_version** (*str*) The LAMMPS version used.\n",
    "- **lammps_date** (*datetime.date*) The date associated with the LAMMPS version.\n",
    "- **simulations** (*list*) information for each simulation (run, minimize ...) that was executed."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "results.lammps_version -> 3 Mar 2020\n",
      "results.lammps_date -> 2020-03-03\n"
     ]
    }
   ],
   "source": [
    "print(\"results.lammps_version ->\", results.lammps_version)\n",
    "print(\"results.lammps_date ->\", results.lammps_date)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Each simulation captures the associated thermo data lines and the computational performance data in separate pandas.DataFrames."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['Step', 'PotEng', 'Temp', 'Press', 'Lx', 'Ly', 'Lz'], dtype='object')"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results.simulations[0].thermo.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>min time</th>\n",
       "      <th>avg time</th>\n",
       "      <th>max time</th>\n",
       "      <th>%varavg</th>\n",
       "      <th>%total</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Section</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>Pair</td>\n",
       "      <td>24.363000</td>\n",
       "      <td>24.627000</td>\n",
       "      <td>24.884000</td>\n",
       "      <td>5.0</td>\n",
       "      <td>88.57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Neigh</td>\n",
       "      <td>0.005595</td>\n",
       "      <td>0.005656</td>\n",
       "      <td>0.005722</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0.02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Comm</td>\n",
       "      <td>1.087600</td>\n",
       "      <td>1.347400</td>\n",
       "      <td>1.616000</td>\n",
       "      <td>21.7</td>\n",
       "      <td>4.85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Output</td>\n",
       "      <td>0.010593</td>\n",
       "      <td>0.010796</td>\n",
       "      <td>0.011395</td>\n",
       "      <td>0.3</td>\n",
       "      <td>0.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Modify</td>\n",
       "      <td>1.530100</td>\n",
       "      <td>1.533900</td>\n",
       "      <td>1.536700</td>\n",
       "      <td>0.2</td>\n",
       "      <td>5.52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Other</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.281500</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.01</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           min time   avg time   max time  %varavg  %total\n",
       "Section                                                   \n",
       "Pair      24.363000  24.627000  24.884000      5.0   88.57\n",
       "Neigh      0.005595   0.005656   0.005722      0.1    0.02\n",
       "Comm       1.087600   1.347400   1.616000     21.7    4.85\n",
       "Output     0.010593   0.010796   0.011395      0.3    0.04\n",
       "Modify     1.530100   1.533900   1.536700      0.2    5.52\n",
       "Other      0.000000   0.281500   0.000000      0.0    1.01"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results.simulations[0].performance"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This makes it very easy to plot the simulation thermo data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAD4CAYAAAD//dEpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deXxU9b3/8dcnK0mAsAUIBAggIJsghE2tRcWqWEttXbBetNZqr9XWa/u7vbX23tr2p7flauu1tba2oNW2WmrdFW211hWQHcK+BEjCFgIJWchMZuZ7/5gTSMJMMpCECeH9fDzmwcz3nPPle+bA5zPfZc6Ycw4REZHmJMS7ASIicnpQwhARkZgoYYiISEyUMEREJCZKGCIiEpOkeDegrfTq1cvl5ubGuxkiIqeV5cuXH3DOZUXa1mETRm5uLsuWLYt3M0RETitmtjPaNg1JiYhITJQwREQkJkoYIiISEyUMERGJiRKGiIjERAlDRERiooQhIiIx6bDfwzgdvb+5hJW7ygg5hwMuH92XUf26xrtZIiKAEka7sXHvYW55ainB0LHfJ3l60Q5e/+an6N8tLX4NExHxKGG0A845/uvldXTtlMQ7355O9/RkCg5U8blffsSdf1zBgq9NIyXp5EcPA8EQBQeqWL/nMJ1Tk7hkZJ9WbP2J8QdCfP+ltXROTWbKkB5Myu1Bj4yUuLVHRGKnhNEOvLJ6N58UHOS/vzD2aPAcktWZudecw9f/uIIH39jA/Z8bfcL1llX7efCNDby0ajf+QAiABIN/f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/OMKurpltp805E/7EPAF43Dl3LlBFeKgimtP+nL1x+1mEh5H6ARnAFRF27UjXuTkneo4nde5KGA0VAQPqvc4BdsepLS1mZsmEk8UfnXMveMX7zCzb254N7PfKo5376fSenA98zsx2AM8RHpZ6BOhmZknePvXbf/TcvO2ZwEFOr3MuAoqcc0u8188TTiAd+TrPAAqccyXOuVrgBeA8OvZ1rtNa17XIe964vElKGA0tBYZ5qy1SCE+QvRLnNp0Ub8XDPGCDc+5n9Ta9AtStlLiZ8NxGXflN3mqLqUC51+V9C/iMmXX3Ptl9xitrd5xz9zrncpxzuYSv3T+cczcC7wLXeLs1Pue69+Iab3/nlc/2VtcMBoYRniBsd5xze4FCMxvhFV0CrKcDX2fCQ1FTzSzd+3ded84d9jrX0yrX1dtWYWZTvffwpnp1RRfvSZ329iC82mAz4RUT98W7PS04jwsIdzHXAKu8x0zCY7fvAFu8P3t4+xvwmHfea4G8enV9BdjqPW6J97nFeP7TObZKagjhQLAV+AuQ6pV38l5v9bYPqXf8fd57sYkYVo/E+VzHA8u8a/0S4dUwHfo6Az8ENgL5wDOEVzp1qOsMPEt4jqaWcI/g1ta8rkCe9/5tA35Jo4UTkR66NYiIiMREQ1IiIhITJQwREYmJEoaIiMRECUNERGKihCEiIjFRwhARkZgoYYiISEz+Dztgg5Sx5PGKAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "for simulation in results.simulations:\n",
    "    plt.plot(simulation.thermo.Step, simulation.thermo.PotEng)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4. Restarting and flattening<a id='section4'></a>\n",
    "\n",
    "There is also some built-in functionality for conveniently handling simulations containing multiple runs and/or multiple sequential simulation executions of the same overall run (i.e. restarts)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 4.1. Running with restart script included\n",
    "\n",
    "Create a new demonstration LAMMPS input script that restarts the previous simulation and runs for an additional 10000 steps."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "restart_script = \"\"\"\n",
    "#Simple demonstration LAMMPS restart script\n",
    "\n",
    "read_restart *.restart\n",
    "\n",
    "mass 1 58.71\n",
    "\n",
    "pair_style lj/cut 6\n",
    "pair_coeff 1 1 0.5408 2.272\n",
    "\n",
    "thermo 100\n",
    "thermo_style custom step pe temp press lx ly lz\n",
    "\n",
    "restart 10000 *.restart\n",
    "\n",
    "fix 1 all npt temp 100 100 1.0 aniso 0.0 0.0 10.0\n",
    "run 10000\n",
    "\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now, if we call run() with either restart_script_name or restart_script set, a number of cool things happen:\n",
    "\n",
    "- If logfile (default log.lammps) does not exist in the working directory then the regular script is passed to LAMMPS./\n",
    "- If logfile does exist then it is moved from NAME.EXT to NAME-&ast;.EXT, where &ast; is the smallest integer not already there, and the restart script is passed to LAMMPS.\n",
    "- Upon completion, the data in NAME.EXT logfile and all NAME-&ast;.EXT logfiles are automatically read in by the Log object."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(3):\n",
    "    results = lmp.run(lammps_command, script=script, mpi_command=mpi_command, restart_script=restart_script)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Show all log files in the run directory"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "log-1.lammps\n",
      "log-2.lammps\n",
      "log-3.lammps\n",
      "log.lammps\n"
     ]
    }
   ],
   "source": [
    "for logfile in glob.iglob('*.lammps'):\n",
    "    print(logfile)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Show that results now has two simulations, one for steps 0 to 10000 and one for steps 10000 to 20000 (the restart)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAD4CAYAAAD//dEpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deXhU5fn/8fcdSFjCvhYBARVwQUVBa7UuVayK+kX7U4tatWrVVmutdlFrrbR1qVtdqlRFcaPuWhUEERdQRESQLexhJyxJCNnXydy/P84hZJkkAwmEyud1XXNl5pmz3HOSzGfO85xzxtwdERGR+iQ0dQEiIvK/QYEhIiJxUWCIiEhcFBgiIhIXBYaIiMSleVMXsLt06dLF+/bt29RliIj8T5kzZ06mu3eN9dx3NjD69u3L7Nmzm7oMEZH/KWa2trbn1CUlIiJxUWCIiEhcFBgiIhIXBYaIiMRFgSEiInFRYIiISFwUGCIiEhcFxk6atz6bxz5ewdqtBU1diojIHvWdPXFvd7l7wmJmr93G5txi7vvJ4U1djojIHqM9jJ20KjPYs1i8MadK+5JNucxdt63W+TLzS7j59XmsztSeicQ2L30exZHipi5D9hIZj/+LtD/+sUpb4dy5eGlpE1WkwNgp2YWlZBUEv6ylm/OIlEcBmJGayVmPfcH5o2cAsDmnuEZ4fL0qi//OTeNHD02lLJxv4YYcfv78LN74Zn2j1JeankdecVnF42jUSU3Pq3OesvIob83ZQGZ+SaPUEFNRNpQ10hvh1pWQu3HH40gpfPgneO1S2Fu/PTKOujYXbOaySZdx55d3ArAyeyXnvXsey7KW7e7qvhNyP/qIklWr9+g6S9etI9pIb96la9cSLdnxPxgtLiZz9Ghy3x9PeX7wIbN0wwbWXnwJG2+7vc5lVV5OY1Ng7ITtewdnH9GDkkiUlRnB42en7/hDLSuPcvn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n62js+v4NHAgMBjYBDzdVXWbWBngb+K2759Y16Z6sLUZdTb7N3L3c3QcDvQg+4R5Sx7KarC4zGwTcDhwMHEPQzXTrnqzLzM4B0t19TuXmOpa12+tSYFS1Aehd6XEvYOPuXqm7bwx/pgP/JfhH2hLuyhL+TK+nxt1Ve2PVsSG83yj1ufuW8J88Cowh2Ga7UlcmQZdC812py8wSCd6U/+Pu74TNTb7NYtW1t2yzsJZsYCrBGEBty6pYf/h8e4Kuyd32P1CprjPDrj139xLgeXZ9e+3q7/EE4P/MbA1Bd9GpBHscTbe96hrg2NduQHOCgap+7BgEOmw3rzMZaFvp/gyCsYcHqTpw+kB4/2yqDrjN8h0DbqsJBts6hvc77UI9fak6uNxodQDfhNNuH/gb3oC6elS6fzNBHy3AYVQd4FtFMLhX6+8WeJOqg4jXx1mTEfRHP1qtvUm3WR11Nek2A7oCHcL7rYAvgHNqWxZwA1UHcd/Y1Xp3sa4elbbno8A/muJvP5z/FHYMejfZ9mryN+m97UZwBMRygr7VO/bA+g4If1HzgUXb10nQ9/gJsCL8uf0Pz4Anw/oWAkMrLesqggGtVODKXajlVYKuijKCTx9XN2YdwFAgJZznCcIrDexiXS+H610AvE/VN8M7wnUso9LRKLX9bsPfwayw3jeBFnHW9UOCXfgFwLzwNrypt1kddTXpNgOOAOaG608B/lLXsoCW4ePU8PkDdrXeXazr03B7pQDj2HEk1R772680/ynsCIwm2166NIiIiMRFYxgiIhIXBYaIiMRFgSEiInFRYIiISFwUGCIiEhcFhoiIxEWBISIicfn/ZDXcp/+SVA8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "for simulation in results.simulations:\n",
    "    plt.plot(simulation.thermo.Step, simulation.thermo.PotEng)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 4.2. Flattening data from multiple simulations together\n",
    "\n",
    "*Changed version 1.3.7* flatten now returns a new Simulation rather than overwriting the current content.\n",
    "\n",
    "The Log.flatten() method creates a new Simulation object that combines the thermo data from all of the simulations.  flatten takes a single parameter that specifies how thermo lines with duplicate timesteps are treated:\n",
    "\n",
    "- 'last' (default) will use values for each timestep from the last runs where they appear.  This is useful for MD restart runs where thermo data from eariler runs may be incomplete if externally stopped.\n",
    "- 'first' will use values for each timestep from the first runs where they appear.  This is useful for quasistatic simulations where minimizations are performed under different conditions and only the final relaxed state of each condition is important.\n",
    "- 'all' will use all thermo lines from all simulations including ones with the same timesteps.  This is useful for \"run 0\" simulations of different conditions, or if the timestep is reset. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAD4CAYAAAD//dEpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deXxU1f3/8dcnCQkQwr7KDoKiqBQQrbsVRdGWamu/VmtttW7V/lpbLba2Vm3tYrUqrUvVIqJ1wV3jCiiILGLYIZAQIEAgZCGQfZ/z++PeDMlkkgxJINS8n4/HPDJzZu6dT+7M3Pfcc+69Y845REREmhLV1gWIiMj/BgWGiIhERIEhIiIRUWCIiEhEFBgiIhKRmLYu4FDp3bu3GzZsWFuXISLyP2XFihW5zrk+4e77ygbGsGHDSEpKausyRET+p5jZ9obuU5eUiIhERIEhIiIRUWCIiEhEFBgiIhIRBYaIiEREgSEiIhFRYIiISEQUGAdp9c79PDpvM9v3Frd1KSIih9VX9sC9Q+VPickkbd/HnoJS/nLZiW1djojIYaMtjIO0Ndfbsli/q6BO+8bMAlbt2NfgdLlF5dz2ymq25WrLRMJbsX0fZZXVbV2GHCH+MTeV215ZX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xzYk+qwvfdrTX8OBwKjzZaXTg0iIiIR0RiGiIhERIEhIiIRUWCIiEhEFBgiIhIRBYaIiEREgSEiIhFRYIiISET+P7PYmb/Me7/TAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "allsims = results.flatten('last')\n",
    "plt.plot(allsims.thermo.Step, allsims.thermo.PotEng)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note that only thermo data is included in the merged simulation and not the performance data."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'None'"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "repr(allsims.performance)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5. Error messages<a id='section5'></a>\n",
    "\n",
    "*LAMMPSError added and error handling improved version 1.3.2*\n",
    "\n",
    "To assist in running LAMMPS simulations, a LAMMPSError error type is defined which does its best to extract the error message that LAMMPS issues as a Python error. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Create a demo script with an error: missing a value in the fix npt line\n",
    "bad_script = \"\"\"\n",
    "#Simple demonstration LAMMPS script\n",
    "\n",
    "units metal\n",
    "atom_style atomic\n",
    "boundary p p p \n",
    "\n",
    "lattice fcc 3.52 origin 0.100000 0.100000 0.100000 \n",
    "        \n",
    "region box block 0 15 0 15 0 15\n",
    "create_box 1 box\n",
    "create_atoms 1 box\n",
    "\n",
    "mass 1 58.71\n",
    "\n",
    "pair_style lj/cut 6\n",
    "pair_coeff 1 1 0.5408 2.272\n",
    "\n",
    "velocity all create 100 2987532\n",
    "\n",
    "thermo 100\n",
    "thermo_style custom step pe temp press lx ly lz\n",
    "\n",
    "restart 10000 *.restart\n",
    "\n",
    "timestep 0.01\n",
    "\n",
    "fix 1 all npt temp 100 100 1.0 aniso 0.0 0.0 \n",
    "run 10000\n",
    "\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "LammpsError raised with message\n",
      "Illegal fix nvt/npt/nph command (../fix_nh.cpp:153)\n",
      "Last command: fix 1 all npt temp 100 100 1.0 aniso 0.0 0.0\n",
      "\n"
     ]
    }
   ],
   "source": [
    "try:\n",
    "    results = lmp.run(lammps_command, script=bad_script, mpi_command=mpi_command)\n",
    "except Exception as ex:\n",
    "    print(type(ex).__name__, 'raised with message')\n",
    "    print(ex.args[0])   "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**File Cleanup**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "os.remove('log.lammps')\n",
    "for restart in glob.iglob('*.restart'):\n",
    "    os.remove(restart)\n",
    "for restart in glob.iglob('log-*.lammps'):\n",
    "    os.remove(restart)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "  "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
